import formatLocation from '../../../../utils/format-location.js';

Component({
  mixins: [],
  data: {
    location: ''
  },
  props: {},
  didMount() {
    this.getLocation()
  },
  didUpdate() { },
  didUnmount() { },
  methods: {
    chooseCity() {
      // var that = this;
      // my.chooseCity({
      //   showLocatedCity: true,
      //   showHotCities: true,
      //   success: (res) => {
      //     console.log(res)
      //     that.setData({
      //       location: res
      //     })
      //     //  this.location = res;
      //     // my.alert({
      //     //   title: 'chooseCity response: ' + JSON.stringify(res),
      //     // });
      //   }
      // })
      my.navigateTo({
      url: "/pages/shop/shop?orderId="
    })
    },
    getLocation() {
      var that = this;
      my.showLoading();
      my.getLocation({
        type: 1,
        success(res) {
          my.hideLoading();
          that.setData({
            location: res
          })
        },
        fail() {
          my.hideLoading();
          my.alert({ title: '定位失败' });
        },
      })
    },

  },
});
